<?php
/************************************************
 *  描述: 错误信息提示类，显示错误信息
 *  作者: firmit 
 *  创建: 2012-03-22
 ************************************************/

class ErrorMsg{
               
    static function fnErrMsg($sErr="", $sTargetPage=NULL, $title="系统信息"){
        GLOBAL $aErrIndex;
        
        if($sTargetPage==NULL){
            $sPrevPage = $_SERVER['HTTP_REFERER'];
            if($sPrevPage == NULL){
                $sPrevPage = "./";
            }
        }else{
            $sPrevPage = $sTargetPage;
        }

        $iFleshTime = 3;

        $sMsg = "<p class=\"ErrMsg\">";
        $sMsg .= ($sErr?"$sErr":"对不起，遇到了一个未定义的错误。请您稍后重试。")."</p>\n";
        $sMsg .= "\t\t\t<p class=\"ErrMsg\">如果浏览器没有自动跳转，请点击 <a href=\"".$sPrevPage."\" class=\"ErrMsg\">这里</a> 返回</p>\n";

        @header("Content-type: text/html;charset=UTF-8");

print<<<ERR
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
html{ margin: 0; padding: 0;}
body{ padding-top:50px; background:#FFFFFF; text-align:center; font-family:"宋体","Times New Roman", "Arial Unicode MS"; font-size:14px; }
body p{ font-size:1em; line-height:1.5em; }
body a{ color:#333333; font-size:1em; text-decoration:none; }
#PageContainer{ background:#FFFFFF; margin:16px auto; text-align: center; width:500px; }
fieldset{ margin-top:50px; padding:2em 2em 1em 2em; width:30em; border:1px solid #C0C0C0; text-align: left; }
legend{ font-size:1em; text-align:center; }
.ErrMsg{ line-height:1.5em; }
</style>
<meta http-equiv="refresh" content="$iFleshTime; URL=$sPrevPage" />
<title>系统提示</title>
</head>

<body>
<div id=PageContainer>
    <fieldset>
        <legend>$title</legend>
            $sMsg
    </fieldset>
</div>
</body>
</html>
ERR;
        exit(1);
    }
}

?>

